package com.gbas.comu.dao;

import org.hibernate.criterion.Criterion;

import javax.persistence.EntityManager;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

public interface JPADAO<T, ID extends Serializable> extends DAO<T, ID> {
    @Override
    int countAll();

    @Override
    int countByExample(T exampleInstance);

    @Override
    List<T> findAll();

    @SuppressWarnings("unchecked")
    @Override
    List<T> findByExample(T exampleInstance);

    @Override
    T findById(ID id);

    @SuppressWarnings("unchecked")
    @Override
    List<T> findByNamedQuery(String name, Object... params);

    @SuppressWarnings("unchecked")
    @Override
    List<T> findByNamedQueryAndNamedParams(String name,
                                           Map<String, ? extends Object> params);

    @Override
    Class<T> getEntityClass();

    @Override
    void delete(final EntityManager em, final T entity);

    @Override
    T save(final EntityManager em, final T entity);

    void deleteCommit(T entity);

    T saveCommit(T entity);

}
